//
//  UUOrderManager.h
//  UUCharterSupplier
//
//  Created by ZhangAo on 22/01/2018.
//  Copyright © 2018 UUCharter. All rights reserved.
//

#import <UUFoundation/DKBaseManager.h>
#import "UUOrderModel.h"

@protocol UUOrderManagerObserver

@optional

- (void)orderManagerDidUpdateOrders:(NSArray<id> *)orders;

- (void)orderManagerDidRemoveOrders:(NSArray<id> *)orders;

@end

#define GetOrderManager()           ([UUOrderManager sharedInstance])

@interface UUOrderManager : DKBaseManager

- (void)asyncUpdateOrders;

- (NSArray<id> *)fetchOrdersForStatus:(UUOrderStatus)status;

- (UUOrderModel *)fetchOrderWithOrderId:(id)orderId;

// 获取订单历史
- (void)asyncFetchOrderHistoryListForOrderId:(id)orderId
                                      length:(int)length
                               completeBlock:(void (^)(NSArray<id> *orders, NSError *error))completeBlock;

// 确认订单
- (void)asyncConfirmOrderWithOrderId:(id)orderId
                             confirm:(BOOL)confirm
                       completeBlock:(void (^)(NSError *error))completeBlock;

// 分配订单
- (void)asyncAssignOrderWithOrderId:(id)orderId
                         dispatches:(NSArray<UUOrderDispatchItemModel *> *)dispatches
                      completeBlock:(void (^)(NSError *error))completeBlock;

// 获取订单详情
- (void)asyncFetchOrderDetailWithOrderId:(id)orderId
                           completeBlock:(void (^)(UUOrderDetailModel *order, NSError *error))completeBlock;

@end
